\(\int \frac {\cot ^4(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx\) [305]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 31 \[ \int \frac {\cot ^4(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=B x+\frac {B \cot (c+d x)}{d}-\frac {B \cot ^3(c+d x)}{3 d} \]

[Out]

B*x+B*cot(d*x+c)/d-1/3*B*cot(d*x+c)^3/d

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {21, 3554, 8} \[ \int \frac {\cot ^4(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=-\frac {B \cot ^3(c+d x)}{3 d}+\frac {B \cot (c+d x)}{d}+B x \]

[In]

Int[(Cot[c + d*x]^4*(a*B + b*B*Tan[c + d*x]))/(a + b*Tan[c + d*x]),x]

[Out]

B*x + (B*Cot[c + d*x])/d - (B*Cot[c + d*x]^3)/(3*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 21

Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> Dist[(b/d)^m, Int[u*(c + d*v)^(m +
 n), x], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c +
 d*x, a + b*x])

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = B \int \cot ^4(c+d x) \, dx \\ & = -\frac {B \cot ^3(c+d x)}{3 d}-B \int \cot ^2(c+d x) \, dx \\ & = \frac {B \cot (c+d x)}{d}-\frac {B \cot ^3(c+d x)}{3 d}+B \int 1 \, dx \\ & = B x+\frac {B \cot (c+d x)}{d}-\frac {B \cot ^3(c+d x)}{3 d} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.02 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.10 \[ \int \frac {\cot ^4(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=-\frac {B \cot ^3(c+d x) \operatorname {Hypergeometric2F1}\left (-\frac {3}{2},1,-\frac {1}{2},-\tan ^2(c+d x)\right )}{3 d} \]

[In]

Integrate[(Cot[c + d*x]^4*(a*B + b*B*Tan[c + d*x]))/(a + b*Tan[c + d*x]),x]

[Out]

-1/3*(B*Cot[c + d*x]^3*Hypergeometric2F1[-3/2, 1, -1/2, -Tan[c + d*x]^2])/d

Maple [A] (verified)

Time = 0.17 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.87

method result size
derivativedivides \(\frac {B \left (-\frac {\left (\cot ^{3}\left (d x +c \right )\right )}{3}+\cot \left (d x +c \right )+d x +c \right )}{d}\) \(27\)
default \(\frac {B \left (-\frac {\left (\cot ^{3}\left (d x +c \right )\right )}{3}+\cot \left (d x +c \right )+d x +c \right )}{d}\) \(27\)
parallelrisch \(-\frac {B \left (\cot ^{3}\left (d x +c \right )-3 d x -3 \cot \left (d x +c \right )\right )}{3 d}\) \(28\)
norman \(\frac {B x \left (\tan ^{3}\left (d x +c \right )\right )+\frac {B \left (\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {B}{3 d}}{\tan \left (d x +c \right )^{3}}\) \(41\)
risch \(B x +\frac {4 i B \left (3 \,{\mathrm e}^{4 i \left (d x +c \right )}-3 \,{\mathrm e}^{2 i \left (d x +c \right )}+2\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}\) \(49\)

[In]

int(cot(d*x+c)^4*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*B*(-1/3*cot(d*x+c)^3+cot(d*x+c)+d*x+c)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 90 vs. \(2 (29) = 58\).

Time = 0.26 (sec) , antiderivative size = 90, normalized size of antiderivative = 2.90 \[ \int \frac {\cot ^4(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=\frac {4 \, B \cos \left (2 \, d x + 2 \, c\right )^{2} + 2 \, B \cos \left (2 \, d x + 2 \, c\right ) + 3 \, {\left (B d x \cos \left (2 \, d x + 2 \, c\right ) - B d x\right )} \sin \left (2 \, d x + 2 \, c\right ) - 2 \, B}{3 \, {\left (d \cos \left (2 \, d x + 2 \, c\right ) - d\right )} \sin \left (2 \, d x + 2 \, c\right )} \]

[In]

integrate(cot(d*x+c)^4*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/3*(4*B*cos(2*d*x + 2*c)^2 + 2*B*cos(2*d*x + 2*c) + 3*(B*d*x*cos(2*d*x + 2*c) - B*d*x)*sin(2*d*x + 2*c) - 2*B
)/((d*cos(2*d*x + 2*c) - d)*sin(2*d*x + 2*c))

Sympy [A] (verification not implemented)

Time = 0.71 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.58 \[ \int \frac {\cot ^4(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=\begin {cases} B x - \frac {B \cot ^{3}{\left (c + d x \right )}}{3 d} + \frac {B \cot {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\\frac {x \left (B a + B b \tan {\left (c \right )}\right ) \cot ^{4}{\left (c \right )}}{a + b \tan {\left (c \right )}} & \text {otherwise} \end {cases} \]

[In]

integrate(cot(d*x+c)**4*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c)),x)

[Out]

Piecewise((B*x - B*cot(c + d*x)**3/(3*d) + B*cot(c + d*x)/d, Ne(d, 0)), (x*(B*a + B*b*tan(c))*cot(c)**4/(a + b
*tan(c)), True))

Maxima [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.23 \[ \int \frac {\cot ^4(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=\frac {3 \, {\left (d x + c\right )} B + \frac {3 \, B \tan \left (d x + c\right )^{2} - B}{\tan \left (d x + c\right )^{3}}}{3 \, d} \]

[In]

integrate(cot(d*x+c)^4*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/3*(3*(d*x + c)*B + (3*B*tan(d*x + c)^2 - B)/tan(d*x + c)^3)/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 69 vs. \(2 (29) = 58\).

Time = 0.41 (sec) , antiderivative size = 69, normalized size of antiderivative = 2.23 \[ \int \frac {\cot ^4(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=\frac {B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 24 \, {\left (d x + c\right )} B - 15 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {15 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - B}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \]

[In]

integrate(cot(d*x+c)^4*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c)),x, algorithm="giac")

[Out]

1/24*(B*tan(1/2*d*x + 1/2*c)^3 + 24*(d*x + c)*B - 15*B*tan(1/2*d*x + 1/2*c) + (15*B*tan(1/2*d*x + 1/2*c)^2 - B
)/tan(1/2*d*x + 1/2*c)^3)/d

Mupad [B] (verification not implemented)

Time = 7.14 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.03 \[ \int \frac {\cot ^4(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=B\,x-\frac {\frac {B}{3}-B\,{\mathrm {tan}\left (c+d\,x\right )}^2}{d\,{\mathrm {tan}\left (c+d\,x\right )}^3} \]

[In]

int((cot(c + d*x)^4*(B*a + B*b*tan(c + d*x)))/(a + b*tan(c + d*x)),x)

[Out]

B*x - (B/3 - B*tan(c + d*x)^2)/(d*tan(c + d*x)^3)